package cn.elegent.txdemo.order.handler;
import cn.elegent.ac.ACHandler;
import cn.elegent.ac.annotation.Topic;
import cn.elegent.txdemo.common.dto.PayDto;
import cn.elegent.txdemo.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 接收消息例子
 */
@Topic("create_order")
@Slf4j
public class OrderHander implements ACHandler<PayDto> {

    @Autowired
    private OrderService orderService;

    @Override
    public void process(String topic,PayDto payDto) throws Exception {
        log.info("订单微服务收到了消息来自："+topic+",数据："+payDto);
        orderService.saveOrder( payDto );
    }
}
